﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using MvcCarConsume.Domain;
using MvcCarConsume.WebUI;
using MvcCarConsume.Domain.Entites;

using System.Web.Mvc;


namespace MvcCarConsume.UnitTest
{
    /*
    [TestClass]
    public class CarViewControllerTest
    {    
        public class TestCarService : ICarService
        {
            public IList<MvcCarConsume.Domain.Entites.Type> Categories
            {
                get
                {
                    return new List<MvcCarConsume.Domain.Entites.Type>{
                        new MvcCarConsume.Domain.Entites.Type{ TypeId = 1, TypeName ="All"},
                        new MvcCarConsume.Domain.Entites.Type{ TypeId = 2, TypeName ="BigCar"},
                        new MvcCarConsume.Domain.Entites.Type{ TypeId = 3, TypeName ="SmallCar"}
                    };
                }
            }
            public IList<Car> CarsWithCurrentCategory(string categoryName)
            {
                if (categoryName == "BigCar")
                {
                    return new List<Car>{
                        new Car{BrandId  = 1, Brand = "BigCar1"},
                        new Car{BrandId = 2, Brand = "BigCar2"}
                    };
                }
                else if (categoryName == "SmallCar")
                {
                    return new List<Car>{
                        new Car{BrandId = 3, Brand = "SmallCar1"},
                        new Car{BrandId = 4, Brand = "SmallCar2"}
                    };
                }
                else if (categoryName == "All")
                {
                    return new List<Car>{
                        new Car{BrandId = 1, Brand = "BigCar1"},
                        new Car{BrandId = 2, Brand = "BigCar2"},
                        new Car{BrandId = 3, Brand = "SmallCar1"},
                        new Car{BrandId = 4, Brand = "SmallCar2"}
                    };
                }
                else
                    return null;
            }
        }

        [TestMethod]
        public void CarView_With_All_Category()
        {
            //arrage
            var controller = new CarViewController(new TestCarService());
            //act
            var result = controller.Index("All");
            //assert
            var model = result.ViewData.Model as VMCarViewIndex;
            model.Cars.Count.ShouldEqual(4);
            model.Category.CategoryName = "All";
            model.Cars[0].CarName = "BigCar1";
            model.Cars[1].CarName = "BigCar2";
            model.Cars[2].CarName = "SmallCar1";
            model.Cars[3].CarName = "SmallCar2";
        }

        [TestMethod]
        public void CarView_With_BigCar_Category()
        {
            //arrage
            var controller = new CarViewController(new TestCarService());
            //act
            var result = controller.Index("BigCar");
            //assert
            var model = result.ViewData.Model as VMCarViewIndex;
            model.Cars.Count.ShouldEqual(2);
            model.Category.CategoryName = "BigCar";
            model.Cars[0].CarName = "BigCar1";
            model.Cars[1].CarName = "BigCar2";
        }
    }
     * */
}
